@extends('backstage.layout.master')
@section('title', '前端配置信息')
@section('style')
<style>
    .ace-file-input input[type=file]{
        position:static;
    }
    .ace-nav {
        height: 10px;
    }
    #container_id{
        align-content: center;
    }
    .detail-create td{
        background-color: #f5f5f5;
    }
    td span{
        font-size: 18px;
    }
</style>
@stop
@section('script')
    <script>
        function update_config_select(th){
            // var value = $("#"+th).val();
            var data = $("#" + th + " option:selected").val();
            // if(value == data) return ;
            // console.log(data,value);
            $.ajax({
                url:"/backstage/config/update-api-config",
                type:"post",
                data:{"id":th,"value":data},
                datatype:'json',
                success:function(re){
                    if(re.state=="M00000"){
                        // $("#"+th).attr("data",value);
                        swal(re.message,'','success');
                        return;
                    }
                    swal(re.message,'','warning');
                    // $("#"+th).val(data);
                    return;
                },
                error:function(){
                    // $("#"+th).val(data);
                    swal('系统繁忙','请稍后重试','warning');return;
                }
            });
        }
        function update_config_input(th){
            // var value = $("#"+th).val();
            var data = $("#" + th).val();
            var type = $("#" + th).attr("data");
            // if(value == data) return ;
            // console.log(data,value);
            $.ajax({
                url:"/backstage/config/update-api-config",
                type:"post",
                data:{"id":th,"value":data,"type":type},
                datatype:'json',
                success:function(re){
                    if(re.state=="M00000"){
                        // $("#"+th).attr("data",value);
                        swal(re.message,'','success');
                        return;
                    }
                    swal(re.message,'','warning');
                    // $("#"+th).val(data);
                    return;
                },
                error:function(){
                    // $("#"+th).val(data);
                    swal('系统繁忙','请稍后重试','warning');return;
                }
            });
        }

    </script>

@stop
@section('content')
    <div class="breadcrumbs" id="breadcrumbs">
        <script type="text/javascript">
            try {
                ace.settings.check('breadcrumbs', 'fixed')
            } catch (e) {
            }
        </script>
        <ul class="breadcrumb">
            <li>
                <i class="icon-home home-icon"></i>
                <a href="/" target="_blank">主页</a>
            </li>
            <li class="active">
                <a href="/backstage/config/api-configs">订单列表</a>
            </li>
        </ul><!-- .breadcrumb -->
    </div>
    <div class="page-content">
        <div class="row">
            <div class="col-xs-12">
                <!-- PAGE CONTENT BEGINS -->
                <div class="page-header">
                    <h1>
                        订单
                        <small>
                            <i class="icon-double-angle-right"></i>
                            订单参数配置
                        </small>
                    </h1>
                </div>
                <div class="row">
                    <div class="col-xs-12">
                        <!-- PAGE CONTENT BEGINS -->
                        <div class="table-responsive">
                            <table id="sample-table-1" class="table table-striped table-bordered table-hover">
                            @if(isset($result))
                                <tr>
                                    <td style="width:138px;">{{isset($result['enable_chat']->description) ? $result['enable_chat']->description : ''}}</td>
                                    <td colspan="5">
                                        <select id="{{isset($result['enable_chat']->id) ? $result['enable_chat']->id : ''}}"
                                        onchange="update_config_select('{{isset($result['enable_chat']->id) ? $result['enable_chat']->id : ''}}')">
                                            <option value="1" @if(isset($result['enable_chat']) && intval($result['enable_chat']->value)) selected="selected" @endif>
                                                是
                                            </option>
                                            <option value="0" @if(isset($result['enable_chat']) && !intval($result['enable_chat']->value)) selected="selected" @endif>
                                                否
                                            </option>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width:138px;">{{isset($result['apply_withddraw_cycle']->description) ? $result['apply_withddraw_cycle']->description : ''}}</td>
                                    <td colspan="5">
                                        <input type="number" data="day"
                                        id="{{isset($result['apply_withddraw_cycle']->id) ? $result['apply_withddraw_cycle']->id : ''}}"
                                        onchange="update_config_input('{{isset($result['apply_withddraw_cycle']->id) ? $result['apply_withddraw_cycle']->id : ''}}')" value="{{isset($result['apply_withddraw_cycle']->value) ? $result['apply_withddraw_cycle']->value : ''}}"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width:138px;">{{isset($result['apply_withddraw_cycle_times']->description) ? $result['apply_withddraw_cycle_times']->description : ''}}</td>
                                    <td colspan="5">
                                        <input type="number"
                                        id="{{isset($result['apply_withddraw_cycle_times']->id) ? $result['apply_withddraw_cycle_times']->id : ''}}"
                                        onchange="update_config_input('{{isset($result['apply_withddraw_cycle_times']->id) ? $result['apply_withddraw_cycle_times']->id : ''}}')" value="{{isset($result['apply_withddraw_cycle_times']->value) ? $result['apply_withddraw_cycle_times']->value : ''}}"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width:138px;">{{isset($result['withdraw_poundage']->description) ? $result['withdraw_poundage']->description : ''}}</td>
                                    <td colspan="5">
                                        <input type="number"
                                        id="{{isset($result['withdraw_poundage']->id) ? $result['withdraw_poundage']->id : ''}}"
                                        onchange="update_config_input('{{isset($result['withdraw_poundage']->id) ? $result['withdraw_poundage']->id : ''}}')" value="{{isset($result['withdraw_poundage']->value) ? $result['withdraw_poundage']->value : ''}}"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width:138px;">{{isset($result['withdraw_max']->description) ? $result['withdraw_max']->description : ''}}</td>
                                    <td colspan="5">
                                        <input type="number"
                                        id="{{isset($result['withdraw_max']->id) ? $result['withdraw_max']->id : ''}}"
                                        onchange="update_config_input('{{isset($result['withdraw_max']->id) ? $result['withdraw_max']->id : ''}}')" value="{{isset($result['withdraw_max']->value) ? $result['withdraw_max']->value : ''}}"/>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width:138px;">{{isset($result['user_bank_card_max']->description) ? $result['user_bank_card_max']->description : ''}}</td>
                                    <td colspan="5">
                                        <input type="number"
                                        id="{{isset($result['user_bank_card_max']->id) ? $result['user_bank_card_max']->id : ''}}"
                                        onchange="update_config_input('{{isset($result['user_bank_card_max']->id) ? $result['user_bank_card_max']->id : ''}}')" value="{{isset($result['user_bank_card_max']->value) ? $result['user_bank_card_max']->value : ''}}"/>
                                    </td>
                                </tr>
                            @endif
                            </table>
                        </div>

                        <!-- <div class="clearfix form-actions" >
                            @if(isset($result->order->order_id))
                            <div class="col-md-offset-3 col-md-9">
                                <button id="saveButton" class="btn btn-info" type="button" onclick="refund();">
                                   <i class="icon-ok bigger-110"></i>
                                   修改
                                </button>
                            </div>
                            @endif
                        </div> -->
                    </div>
                </div>
                <!-- PAGE CONTENT ENDS -->
            </div><!-- /.col -->
        </div><!-- /.row -->
    </div><!-- /.page-content -->
@stop
